package com.mt.api.constants.enums;

import com.mt.api.util.EnumMappingUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * @Author: plover
 * @Date: 2021/01/25/10:27
 * @Description: 用户等级
 */
@Getter
@AllArgsConstructor
public enum UserLevelEnum {
    INIT(0, "初始登录用户"),
    BRAND_CERTIFIED(1, "品牌已认证"),
    V1(2, "V1"),
    V2(3, "V2"),
    V3(4, "V3"),
    ;

    private Integer code;
    private String name;

    private static final Map<Integer, UserLevelEnum> statusEnumMap =
            EnumMappingUtil.toMappingMap(UserLevelEnum.class, UserLevelEnum::getCode);

    public static UserLevelEnum ofCode(Integer code) {
        return statusEnumMap.get(code);
    }

}
